/**
 * 
 */
package br.embedded.ufcg.rmi;

import java.io.Serializable;

/**
 * @author daniel
 *
 */
public class StatisticsInfo implements Serializable, Comparable<StatisticsInfo>
{
	private String nodeIp;
	private int vertexCount;
	private int edgesCount;
	private String topology;
	private int maxLevels;
	private int threadCount;
	private long elapsedTime;
	
	public StatisticsInfo()
	{
	}
	
	/**
	 * @param nodeIp
	 * @param vertexCount
	 * @param edgesCount
	 * @param maxLevels
	 * @param threadCount
	 * @param elapsedTime
	 */
	public StatisticsInfo(String nodeIp, int vertexCount, int edgesCount,
			int maxLevels, int threadCount) {
		
		this.nodeIp = nodeIp;
		this.vertexCount = vertexCount;
		this.edgesCount = edgesCount;
		this.maxLevels = maxLevels;
		this.threadCount = threadCount;
	}

	/**
	 * @return the nodeIp
	 */
	public String getNodeIp() {
		return nodeIp;
	}

	/**
	 * @param nodeIp the nodeIp to set
	 */
	public void setNodeIp(String nodeIp) {
		this.nodeIp = nodeIp;
	}

	/**
	 * @return the vertexCount
	 */
	public int getVertexCount() {
		return vertexCount;
	}

	/**
	 * @param vertexCount the vertexCount to set
	 */
	public void setVertexCount(int vertexCount) {
		this.vertexCount = vertexCount;
	}

	/**
	 * @return the edgesCount
	 */
	public int getEdgesCount() {
		return edgesCount;
	}

	/**
	 * @param edgesCount the edgesCount to set
	 */
	public void setEdgesCount(int edgesCount) {
		this.edgesCount = edgesCount;
	}

	/**
	 * @return the maxLevels
	 */
	public int getMaxLevels() {
		return maxLevels;
	}

	/**
	 * @param maxLevels the maxLevels to set
	 */
	public void setMaxLevels(int maxLevels) {
		this.maxLevels = maxLevels;
	}

	/**
	 * @return the threadCount
	 */
	public int getThreadCount() {
		return threadCount;
	}

	/**
	 * @param threadCount the threadCount to set
	 */
	public void setThreadCount(int threadCount) {
		this.threadCount = threadCount;
	}

	/**
	 * @return the elapsedTime
	 */
	public long getElapsedTime() {
		return elapsedTime;
	}

	/**
	 * @param elapsedTime the elapsedTime to set
	 */
	public void setElapsedTime(long elapsedTime) {
		this.elapsedTime = elapsedTime;
	}
	
	/**
	 * @return the topology
	 */
	public String getTopology() {
		return topology;
	}

	/**
	 * @param topology the topology to set
	 */
	public void setTopology(String topology) {
		this.topology = topology;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		
		sb.append(getNodeIp());
		sb.append(";");
		sb.append(getVertexCount());
		sb.append(";");
		sb.append(getEdgesCount());
		sb.append(";");
		sb.append(getTopology());
		sb.append(";");
		sb.append(getMaxLevels());
		sb.append(";");
		sb.append(getThreadCount());
		sb.append(";");
		sb.append(getElapsedTime());
		
		return sb.toString();
	}
	
	@Override
	public int compareTo(StatisticsInfo arg0) {
		
		if (getElapsedTime() == arg0.getElapsedTime())
			return 0;
		if (getElapsedTime() < arg0.getElapsedTime())
			return -1;
		
		return 1;
	}
}
